package cn.edu.gdpt.mobile213.mobile2121606097wjc0515;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import java.util.ArrayList;
import java.util.List;

public class ActivityAdapter extends RecyclerView.Adapter<ActivityAdapter.ViewHolder> {
    private List<String>list=new ArrayList<>();
    public ActivityAdapter(List<String>list){this.list=list;}
    static class ViewHolder extends RecyclerView.ViewHolder{
        TextView tvActivity;
        public ViewHolder(@NonNull View itemView){
            super(itemView);
            tvActivity=(TextView) itemView.findViewById(R.id.tvActivity);
        }
    }
    @NonNull
    @Override
    public ActivityAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent,int viewType){
        View view= LayoutInflater.from(parent.getContext()).inflate(R.layout.item_rv_activity,null);
        return new ViewHolder(view);
    }
    @Override
    public void onBindViewHolder(@NonNull ActivityAdapter.ViewHolder holder,int position){
        holder.tvActivity.setText(list.get(position));
    }
    @Override
    public int getItemCount(){return list.size();}
}